﻿using BaseUtils.Helper;
using DatabaseCore.Sqlite;
using Service.src.Flow.Server;
using System.Runtime.InteropServices;

namespace Service.src.Flow.Api
{

    [ComVisible(true)]
    [ClassInterface(ClassInterfaceType.AutoDual)]
    public class EventApi
    {

        /// <summary>
        /// 查找事件
        /// </summary>
        /// <returns></returns>
        public string SearchEvent()
        {
            EventServer Event = new EventServer();
            return Event.SearchEvent(SqliteHelper.SystemDefaultDBID).ToJson();
        }

        /// <summary>
        /// 新增事件
        /// </summary>
        /// <param name="EventJson"></param>
        /// <returns></returns>
        //public string AddEvent(string EventJson)
        //{
        //    EventServer Event = new EventServer();
        //    return Event.AddEvent(SqliteHelper.SystemDefaultDBID, EventJson).ToJson();
        //}

        /// <summary>
        /// 更新事件
        /// </summary>
        /// <param name="EventJson"></param>
        /// <returns></returns>
        //public string UpdateEvent(string EventJson)
        //{
        //    EventServer Event = new EventServer();
        //    return Event.UpdateEvent(SqliteHelper.SystemDefaultDBID, EventJson).ToJson();
        //}

        /// <summary>
        /// 根据ID删除事件
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public bool DeleteEvent(int Id)
        {
            EventServer Event = new EventServer();
            return Event.DeleteEvent(SqliteHelper.SystemDefaultDBID, Id);
        }
    }
}